<template>
	<up-tabbar :value="activeIndex" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true" activeColor="#333333">
		<up-tabbar-item v-for="(item,index) in list" :key="index" :text="item.label"
			:icon="activeIndex == item.index?item.activeIcon:item.icon" @click="tabClick(item)"></up-tabbar-item>
	</up-tabbar>
</template>

<script lang="ts" setup>
	import { ref, reactive, getCurrentInstance } from "vue";
	import { defineProps, withDefaults } from 'vue';
	const { proxy } = getCurrentInstance()
	const activeIndex = ref(0)
	const propsA = withDefaults(defineProps<{ activeTab ?: any }>(), {
		activeTab: () => 0
	});
	activeIndex.value = propsA.activeTab
	const list = ref([
		{ index: 0, label: '消息', icon: '/static/images/user/tabbar/tabbar4.png', activeIcon: '/static/images/user/tabbar/tabbar4.png', url: '/pages/salesman/news/index' },
		{ index: 0, label: '我的', icon: '/static/images/user/tabbar/tabbar5.png', activeIcon: '/static/images/user/tabbar/tabbar5.png', url: '/pages/salesman/my/index' },
	])

	const tabClick = (e) => {
		activeIndex.value = e.index
		if (e.url) {
			uni.reLaunch({
				url: e.url
			})
		}
		console.log(e.label);
	}
</script>

<style lang="scss" scoped>

</style>